﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Display.peddlerUI.peddlerMarketUI.list {
    import org.aswing.*;
    import org.aswing.geom.*;
    import Display.CopsBanditsUI.*;
    import Display.peddlerUI.peddlerMarketUI.data.*;
    import org.aswing.ext.*;
    import Display.peddlerUI.peddlerMarketUI.factory.*;
    import Display.peddlerUI.peddlerMarketUI.cell.*;

    public class PeddlerListPanel extends OfficersScrollingList {

        public function PeddlerListPanel(_arg1:GridListCellFactory=null, _arg2:Array=null, _arg3:int=1, _arg4:int=0){
            m_cellFactory = ((_arg1 == null)) ? new PeddlerCellFactory() : _arg1;
            m_data = _arg2;
            m_columns = _arg3;
            m_rows = _arg4;
            super();
        }
        override protected function init():void{
            var _local1:IntDimension = new IntDimension(ROW_WIDTH, ROW_HEIGHT);
            this.makeData();
            initSize();
            prepare();
        }
        override protected function makeData():void{
            if (m_data){
                m_model = new VectorListModel();
                m_model.clear();
                this.makeModle();
                m_dataList = new GridList(m_model, m_cellFactory, m_columns, m_rows);
                m_dataList.setColumns(m_columns);
                m_dataList.setVGap(1);
                m_scrollPane = new JScrollPane(m_dataList, JScrollPane.SCROLLBAR_NEVER, JScrollPane.SCROLLBAR_NEVER);
            };
        }
        public function updateCellData(_arg1:PeddlerData):void{
            var _local4:PeddlerData;
            var _local5:PeddlerCell;
            var _local2:int = m_model.getSize();
            var _local3:int;
            while (_local3 < _local2) {
                _local4 = m_model.get(_local3);
                if (_local4){
                    if (_arg1.peddlerId == _local4.peddlerId){
                        _local5 = (m_dataList.getCellByIndex(_local3) as PeddlerCell);
                        _local5.setCellValue(_arg1);
                    };
                };
                _local3++;
            };
        }
        private function makeModle():void{
            var _local1:int = m_data.length;
            var _local2:int = (USABLE_ROWS - _local1);
            var _local3:int;
            while (_local3 < _local1) {
                m_model.append(m_data[_local3]);
                curCount++;
                _local3++;
            };
            _local3 = 0;
            while (_local3 < _local2) {
                m_model.append(null);
                curCount++;
                _local3++;
            };
        }
        public function updataAllCells(_arg1:Array):void{
            m_data = _arg1;
            m_model.clear();
            this.makeModle();
        }

    }
}//package Display.peddlerUI.peddlerMarketUI.list 
